package 算法练习;
/**
 * @author： li
 * @date： 2022-01-09 19:02
 * @version 1.0
 */
import java.util.Scanner;
public class 礼物02 {
    private static int n;
    private static long s;
    private static long[] sum = new long[1000000];
    private static int l;
    private static int r= 1000000;
    private static boolean check(int k){
        for (int t = k; t <=n-k; t++) {
            if (sum[t]-sum[t-k]<=s&&sum[k+t]-sum[t]<=s)
                return true;
        }
        return false;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        s = sc.nextLong();
        String[] strings = new String[n+1];
        for (int i = 1; i <=n; i++) {
            strings[i] =sc.next();
            sum[i]= Long.parseLong(strings[i])+sum[i-1];
        }
        sc.close();
        while(l<r){
            int mid=(l+r+1)/2;
            //System.out.println(mid);
            if(check(mid))
                l=mid;
            else
                r=mid-1;
        }
        System.out.println(2*l);
    }
}